/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uploadphotobucket.errorcode;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * Provide message correspond error code from server
 * @author banhbaochay
 */
public class ErrorCode {

    public ErrorCode(int errorCode) {
        this.errorCode = Integer.toString(errorCode);
        resource = ResourceBundle.getBundle("resourcebundle/ErrorMessage");
    }// end constructor

    public boolean isPredefined() {
        return resource.containsKey(errorCode);
    }// end isPredefined method

    /**
     * Get message correspond error code from server
     * @return Message if code is pre-defined
     * @throws MissingResourceException if code is not pre-defined
     */
    public String getMessage() {
        return resource.getString(errorCode);
    }// end getMessage method
    private String errorCode;
    private ResourceBundle resource;
}// end ErrorCode class

